#! /bin/sh

ndir=`pwd`

kdbxfile="$ndir/YE_KEY_BOX.kdbx"

if [ -e $kdbxfile ]
then
	echo "found: $kdbxfile"
	base64 $kdbxfile > $ndir/YE_KEY_BOX.base64
	echo "Convert binto base64: $ndir/YE_KEY_BOX.base64"	

	read -r -p "Do you want to delete .kdbx? [Y/n] " input
	case $input in
		[yY][eE][sS]|[yY])
			rm -f $kdbxfile
			echo "Deleted: $kdbxfile"
			;;

		[nN][oO]|[nN])
			echo "No"
			;;

		*)
			echo "Invalid input..."
			exit 1
			;;
	esac
	git add .
        git commit -m '`head -c 8 $ndir/YE_KEY_BOX.base64`'
        git push origin master
fi

